package com.itheima.mystream;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

public class Demo4 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三丰", "张殿峰", "张四丰", "张无忌", "李四", "王五"));
        Stream<String> limitStream = list.stream().limit(2);
        //limitStream.forEach(System.out::println);
        System.out.println("=============================");

        Stream<String> skipStream = list.stream().skip(2);
        //skipStream.forEach(System.out::println);
        System.out.println("=============================");

        Stream<String> concatStream = Stream.concat(limitStream, skipStream);
        concatStream.forEach(System.out::println);
        System.out.println("=============================");

        /*Stream<String> distinctStream = concatStream.distinct();
        distinctStream.forEach(System.out::println);*/
    }
}
